<?php

/**
 * 意见反馈
 */
namespace app\api\controller\user;

use app\api\controller\Common;
use think\Db;

class Search extends Common
{
    protected $data;
    public function initialize()
    {
        $this->data = $this->request->except(['sign','accessKey','token']);
    }

    /**
     * 搜索历史
     */
    public function log(){
        
        $user_id = $this->user['id'];
        $type_id = input('type_id');
        $limit = input('limit', 10);
        $user_id = 1;
        
        $res = db('search_log')->distinct('keyword')->field('keyword')->where(['user_id'=>$user_id, 'type_id'=>$type_id])->order('id','desc')->limit($limit)->select();
        return $this->showSuccess('搜索历史', $res);
    }
}